package com.zhuhjay.ruiji.common;

/**
 * 基于ThreadLocal封装的工具类, 用于保存和获取当前登录用户的id
 * @author ZhuHJay
 * @date 2022/5/16 13:38
 */
public class BaseContext {

    private final static ThreadLocal<Long> THREAD_LOCAL = new ThreadLocal<>();

    public static void setCurrent(Long id){
        THREAD_LOCAL.set(id);
    }

    public static Long getCurrent(){
        return THREAD_LOCAL.get();
    }

}
